class CreateSalesFirmLeads < ActiveRecord::Migration[5.1]
  def change
    create_table :sales_firm_leads do |t|
      t.integer :firm_id, comment: '相关公司'
      t.integer :leads_type, comment: '跟进类型'
      t.datetime :begin_at, comment: '开始跟进时间'
      t.datetime :expire_at, comment: '到期时间'
      t.integer :user_id, comment: '相关跟进人'
      t.integer :stage, comment: '跟进状态'

      t.timestamps
    end

    add_index :sales_firm_leads, :firm_id
    add_index :sales_firm_leads, :leads_type
    add_index :sales_firm_leads, :begin_at
    add_index :sales_firm_leads, :expire_at
    add_index :sales_firm_leads, :user_id
    add_index :sales_firm_leads, :stage
  end
end
